<?php

namespace app\api\controller;

use app\common\controller\Api;
use fast\AdapayUtil;
use think\Db;
use think\Log;


/**
 * 首页接口
 */
class Notify extends Api
{
    protected $noNeedLogin = ['*'];
    protected $noNeedRight = ['*'];




    public function Yongyou()
    {
        


        $post = file_get_contents( "php://input");
        $post = json_decode($post,true);
        logs('yongyou_notify2',json_encode($post,JSON_UNESCAPED_UNICODE));         
        
        $encryptedText = $post['encryptMsg']; // 这里替换为你的Base64加密字符串
        $key = "aRagvc0GMFCj5zVM"; // AES-128 密钥必须是 16 字节长
        
        $decryptedText = aesDecrypt($encryptedText, $key);
        $data = json_decode($decryptedText,true);


        if ($data['msgType'] == 'APP_TICKET') {
            
            $map['id'] = 1;
            $updata['appTicket'] = $data['bizContent']['appTicket'];
            Db::table('fa_yongyou')->where($map)->update($updata);
        }

        $result['result'] = 'success';

        return json_encode($result);
 

        
    }



}
